package com.github.kezhenxu94.playground.java.miscellaneous;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by com.ikezhenxu.java.study on 12/23/14.
 */
public class StringTest {

	@Test
	public void stringInternTest() {
		String hello1 = new String("Hello world");
		String hello2 = new String("Hello world");
		System.out.println(hello1.hashCode());
		System.out.println(hello2.hashCode());
		List<String> mStrings = new ArrayList<>();
		while (true) {
			mStrings.add(String.valueOf(System.currentTimeMillis()).intern());
		}
	}
}
